#include "UdpServer.hpp"
#include "Dict.hpp"
#include "InetAddr.hpp"
#include <memory>

std::string chanck(const std::string& s)
{
    if(s == "666")
    {
        return "成功";
    }
    return "失败";
}
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " port" << std::endl;//使用格式不正确
    }
    Enable_Console_Log_Strategy();
    //std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);

    Dict dict;
    dict.Load();
    std::unique_ptr<Server> s = std::make_unique<Server>(port, [&dict](const std::string& word, Inet_Addr& peer)->std::string{
        return dict.Translate(word,peer);
    });
    s -> Init();
    s -> Start();
    return 0;
}
